<template>
    <div class="header">
        <el-tabs type="card" closable v-model="activePane">
            <el-tab-pane label="授信额度结果查询" name="1" v-if="showResource || checkPermission('B_0337')">
                <CreditLimit key="today" type="today" />
            </el-tab-pane>
            <el-tab-pane label="白名单条目映射" name="2" v-if="showResource || checkPermission('B_0338')">
                <WhiteList key="history" type="history" />
            </el-tab-pane>
        </el-tabs>
    </div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import CreditLimit from './credit-limit.vue';
import WhiteList from './white-list.vue';
import { getUser } from '@/utils/user-util';
import { checkPermission } from '@/utils/tools';

@Component({ name: 'OIS', components: { CreditLimit, WhiteList } })
export default class OIS extends Vue {
    activePane: string = '1';
    showResource: boolean = false; // 是否显示字段
    checkPermission = checkPermission;

    mounted() {
        this.showResource = getUser().superuser;
        if (!checkPermission('B_0337') && checkPermission('B_0338')) {
            this.activePane = '2';
        }
        console.log(this.showResource, 'showResource');
    }
}
</script>
<style lang="scss" scoped>
.header {
    min-width: 1200px;
    padding-top: 4px;
    height: 100%;
}
/deep/ .el-tabs > .el-tabs__header .el-tabs__item {
    border: 1px solid #e4e7ed;
    // border-bottom: none;
    padding: 0 14px;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    &:nth-child(2) {
        padding-left: 14px;
    }
    &:last-child {
        padding-right: 14px;
    }
}
/deep/ .el-tabs {
    height: 100%;
    .el-tabs__nav {
        border: none;
        .is-active {
            border-color: #409eff;
            border-bottom: 2px solid #409eff;
        }
    }
    .el-tabs__content {
        // padding: 20px;
        height: calc(100% - 35px);
        overflow: auto;
        .el-tab-pane {
            color: #333;
            height: 100%;
        }
    }
}

/deep/ .el-form .el-form-item__label {
    color: #333;
    padding: 0px;
}
/deep/ .el-tabs .el-tabs__nav .el-tabs__item {
    // line-height: 34px;
    padding: 0 25px !important;
}

/deep/ .el-tabs .el-tabs__nav .el-tabs__item span {
    border-right: 0px solid #fff;
}
/deep/ .el-tabs .el-tabs__nav .el-tabs__item:nth-child(-n + 2) .el-icon-close {
    display: none;
}
</style>
